//获取书柜编号
var code= GetQueryString("code");
var gridCode = code+"01";
$(function () {
    $("#jqGrid").jqGrid({
    	url: baseURL + 'operation/bookShelf/getBookGridInfo?bookGridCode='+gridCode,
        contentType : "application/json; charset=utf-8",
        datatype: "json",
        colModel: [			
			{ label: 'RFID编号', name: 'rfidCode',index:"rfid_code",width:220,align:'center' },
			{ label: 'ISBN编号', name: 'isbnNo',index:"isbn_no",width:140 ,align:'center' },
			{ label: '书籍名称', name: 'bookName',index:"book_name" ,width:280,align:'center' }
        ],
		viewrecords: true,
        height: 385,
        rowNum: 10,
		rowList : [10,30],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        autoScroll:true,
        shrinkToFit:false,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        }
        
    });
    //$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ 'overflow-y' : 'scroll' });  
    /*创建jqGrid的操作按钮容器*/
    /*可以控制界面上增删改查的按钮是否显示*/
    //jQuery("#jqGrid").jqGrid('navGrid', '#jqGridPager', {edit : true,add : true,del : true});
    //表格宽度自适应
    $(function(){
       $(window).resize(function(){
          $("#jqGrid").setGridWidth($(window).width());
       });
    });
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
			gridCode: null,
		},
		showList: true,
		title: null
	},
	methods: {
		query: function (bookGrid) {
			gridCode = code+bookGrid;
			vm.reload();
		},
		reload: function (event) {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam', {
				postData : {
					'newGridCode' : gridCode
				},
				page : page
			}).trigger("reloadGrid");
		}
	}
});